Deploy an ERC-20 Contract (Using thirdweb)
Learn how to deploy an ERC-20 contract with thirdweb.
Deploying a token on Unichain with thirdweb is as simple as deploying a smart contract. You can choose between two approaches, dependent on how the token intends to be distributed.
- Use the Token contract when:
- You need full control over token minting and distribution.
- You want to reward users with tokens for specific actions.
The Token contract is great for when you don't need pre-defined claim conditions or public distribution mechanisms.
- Use the Token Drop contract when:
- You have a known distribution plan
- You want users to claim their distribution
The Token Drop contract offers more structured and controlled token distribution, allowing you to set up complex release strategies.
Requirements
ETH on Unichain is required, see thirdweb Unichain Faucet
The guide requires a thirdweb account for deployments. Create one here: thirdweb dashboard
Steps to Deploy
Deploy a thirdweb pre-built contract through UI!
-
Navigate to the thirdweb contract explore page and select a contract you would like to deploy.
In this example we will be deploying an ERC-20 contract, but this method works for any of thirdweb's prebuilt contracts.
-
View Contract Page
You can read some details about the contract as well as see some common uses cases. Click on 'Deploy Now' in the top right corner to deploy the contract.
-
Fill in Contract Details
- Fill in the contract metadata such as Image, Name, and description.
- The rest of the details are autofilled and are acceptable for most use cases. If you require any special configurations for recipent addresses or trusted forwarders be sure to apply them here.
- When selecting your chain you can either search for
Unichain Sepolia Testnet
or by chain id1301
- Finally, click on
Deploy Now
to deploy your contract to the Unichain Sepolia Testnet.NOTE: The number next to the
Deploy Now
button denotes the number of transactions that will occur. All but 1 of the transactions will incur a gas cost. - Click on
View Now
to be taken to the newly deployed contract in your dashboard.
Set Your Supply
For Token contracts:
-
Click on
Tokens
on the left hand menu -
Click on the blue
Mint
button -
Specify the amount of tokens you wish to mint and click on
Mint tokens
From here you can distribute these tokens through transfer events with the thirdweb sdk or even as reward to users with thirdweb engine!
For Token Drop contracts:
-
Click on
Claim Conditions
on the left hand menu -
Click on
Add Phase
-
Choose who can mint tokens during this phase. There are 4 different options:
- Only the contract owner can mint.
- Public, where anyone can mint.
- Public (With Allowlist) defines a public mint with some wallet addresses having special rules.
- Allowlist Only, where only specified wallets are allowed to mint.
-
Fill in the claim condition fields according to the desired distribution. The "How many tokens will you drop in this phase?" section is where you will be defining your supply. Additional phases will increase the supply too. Additional phases will increase the supply accordingly.
-
Click on
Save Phases
-
Transferring Tokens (Optional)
Both contract types allow for token transfers. You can transfer through the contract's transfer function or using the thirdweb sdk. If claiming through a Token Drop contract, tokens are minted directly to a user's wallet.
Last updated on